﻿<!DOCTYPE html>
<html lang="en">
<head>
    <title>宾果高校</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/sweetalert.min.css" />
    <style>
        body {
            padding-top: 280px;
        }

        ul > li {
            float: left;
        }
    </style>
</head>
<body>
    <div class="orange">
        <div class="logo-auditid"><img src="images/logo-white.png" alt=""></div>
    </div>
    <div class="main">
        <div class="wrap">
            <div class="reset-box">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <div class="auditid-wrap">
                            <div class="auditid-step">
                                <ul class="clearfix">
                                    <li style="margin-left: 16px;">
                                        <h2 style="color: #FF4500;" class="text-center">01</h2>
                                        <div>验证手机号</div>
                                    </li>
                                    <div class="step-line"></div>
                                    <li style="margin-left: 10px;">
                                        <h2 class="text-center">02</h2>
                                        <div>重置密码</div>
                                    </li>
                                </ul>
                            </div>
                            <form id="formValidate" action="" class="form-horizontal">
                                <div class="form-group">
                                    <input type="number" data-minlength="11" id="UserName" data-maxlength="11" placeholder="请输入注册时使用的手机号" data-error="请输入已验证手机号码" autofocus="autofocus" required class="form-control">
                                    <div class="help-block with-errors"></div>
                                </div>
                                <div class="form-group form-inline">
                                    <input type="number" name="" id="code" data-minlength="4" data-maxlength="4" style="display: inline-block;width: 218px;" placeholder="请输入短信验证码" data-error="请输入四位数的验证码" required class="form-control">
                                    <button id="getAuditcode" class="btn btn-default">获取验证码</button>
                                    <div class="help-block with-errors"></div>
                                    <input type="text" id="ValidType" value="ChangePassword" class="hidden" />
                                </div>
                                <div id="divReminder" style="color:red; "></div>
                                <div class="form-group">
                                    <button type="button" id="btnSubmit" class="btn btn-default btn-block">找回密码</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="footer">
        <div class="auditid-slogan text-center">
            <p>— 宾果高校为赞助而生 —</p>
        </div>
    </div>
</body>
</html>
<script src="js/jquery-1.12.2.min.js"></script>
<script src="js/validator.min.js"></script>
<script src="js/sha512.js"></script>
<script src="js/common.js"></script>
<script src="js/login.js"></script>
<script src="js/sweetalert.min.js"></script>
<script>

    var phoneNo, type, code;

    function AfteAjax(ctx) {
        if (ctx == "" || ctx == null) {
            $("#divReminder").html("").append("该手机已注册");
            return;
        }

        $("#divReminder").html("").append("验证码已经发出，请注意查收");
    }

    function AfteAjax1(ctx) {

        if (ctx == "" || ctx == null) {
            $('#divReminder').html("").append("操作失败，请重试！");
            return;
        }

        window.location = "reset.html?id=" + phoneNo + "&code=" + code;
    }

    $(document).ready(function () {

        $("#getAuditcode").click(function () {

            phoneNo = $('#UserName').val();
            type = $('#ValidType').val();

            if (!common.checkValue(phoneNo))
                return;

            common.commonAjax({ type: 'Get', url: 'api/login/get?id=' + phoneNo + "&validType=" + type, sMethod: AfteAjax });
        })

        $("#btnSubmit").click(function () {

            if (!common.validateForm())
                return;

            phoneNo = $('#UserName').val();
            type = $('#ValidType').val();
            code = $('#code').val();

            common.commonAjax({ type: 'Get', url: 'api/login/get?id=' + phoneNo + "&validType=" + type + "&code=" + code, sMethod: AfteAjax1 });
        })
    });
</script>